package com.sh.data.engine.common.enumDefinition;

import java.util.Objects;

public enum FlinkFunctionTypeEnum {
    UDF(1, "UDF"),
    UDAF(2, "UDAF"),
    UDTF(3, "UDTF");

    private Integer functionType;

    private String functionDesc;

    FlinkFunctionTypeEnum(Integer nodeType, String nodeDesc) {
        this.functionType = nodeType;
        this.functionDesc = nodeDesc;
    }

    public Integer getFunctionType() {
        return functionType;
    }

    public String getFunctionDesc() {
        return functionDesc;
    }

    public static FlinkFunctionTypeEnum of(Integer nodeType) {
        for (FlinkFunctionTypeEnum nodeTypeEnum : FlinkFunctionTypeEnum.values()) {
            if (Objects.equals(nodeTypeEnum.functionType, nodeType)) {
                return nodeTypeEnum;
            }
        }
        return null;
    }
}
